<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="js/jquery-3.1.1.min.js"></script>
<script type="text/javascript" src="js/jquery-1.8.3.js"></script>
<script type="text/javascript">
        $(function(){
        	$("#tanqi").blur(function(){
                 var name=$("#tanqi").val();
/*                  $.ajax({
    				 type:"POST",
    				 url:"selectAll?time="+new Date().getTime(),
    			     data:{"username":name},
    			     success:function(backDate){
    			    	if(backDate.user!=null){
    			    		$("span").html("此用户名已被占用");
    			    	}else{
    			    		$("span").html("此用户名可以使用");
    			    	}
    			     }
    			   }); */
    			   $.post("selectAll?time="+new Date().getTime(),{"username":name},function(date){
    				   if(date.user!=null){
    					   $("span").html("此用户名已被占用");
    				   }else{
    					   $("span").html("此用户名可以使用");
    				   }
    			   });
        	});
        })
</script>
</head>
<body>
     <form>
          账号：<input type="text" name="username" id="tanqi"><span></span><br/>    
         密码：<input type="password" name="userpass"><br/>
         <input type="submit" value="注册">
     </form>
</body>
</html>